package lines.gameengine.context;

import lines.gameengine.tracer.IFieldTracer;
import lines.gameengine.util.IBallGenerator;
import lines.gameengine.util.ICellsChooser;
import lines.gameengine.util.IScoreHolder;

/**
 * @author vpotapenko
 */
public class FieldContext implements IFieldContext {

    private final FieldParameters parameters = new FieldParameters();

    private IBallGenerator ballGenerator;
    private ICellsChooser cellsChooser;
    private IScoreHolder scoreHolder;
    private IFieldTracer tracer;

    private FieldState state = FieldState.UNDEFINED;

    public void setBallGenerator(IBallGenerator ballGenerator) {
        this.ballGenerator = ballGenerator;
    }

    public void setCellsChooser(ICellsChooser cellsChooser) {
        this.cellsChooser = cellsChooser;
    }

    public void setScoreHolder(IScoreHolder scoreHolder) {
        this.scoreHolder = scoreHolder;
    }

    public void setTracer(IFieldTracer tracer) {
        this.tracer = tracer;
    }

    public void setState(FieldState state) {
        this.state = state;
    }

    @Override
    public void setFieldState(FieldState state) {
        this.state = state;
    }

    @Override
    public FieldState getFieldState() {
        return state;
    }

    @Override
    public FieldParameters getParameters() {
        return parameters;
    }

    @Override
    public IBallGenerator getBallGenerator() {
        return ballGenerator;
    }

    @Override
    public ICellsChooser getCellsChooser() {
        return cellsChooser;
    }

    @Override
    public IScoreHolder getScoreHolder() {
        return scoreHolder;
    }

    @Override
    public IFieldTracer getTracer() {
        return tracer;
    }
}
